<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
  export default {
    created() {

    },
    mounted() {
      window.onresize = () => {
        const bodyScale = () => {
          let devicwidth = document.documentElement.clientWidth
          let scale = devicwidth / 1920
          document.body.style.zoom = scale

          // console.log('document.body.style.zoom', typeof devicwidth)
        }
      }
      if (this._isMobile()) {
        let devicwidth = document.documentElement.clientWidth
        let scale = devicwidth / 750
        document.body.style.zoom = scale + 'px'
        this.$store.state.print.devic = devicwidth
        // console.log('document.body.style.zoom', this.$store.state.print.devic ,typeof devicwidth)
        localStorage.setItem('devicwidth',devicwidth)
        // alert("手机端");
        console.log('手机端',devicwidth)

      } else {
        // alert("pc端");
        let devicwidth = document.documentElement.clientWidth
         // this.$store.state.print.devic = 2
         localStorage.setItem('devicwidth','')
      }

    },
    methods: {
      //App.vue
      _isMobile() {
        let flag = navigator.userAgent.match(
          /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
        )
        return flag;
      }
    }

  }
</script>

<style>
  @import '../static/css/index.css';
</style>
